﻿using System;
using System.Collections.Generic;
using BO.Admin;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace ProjectQuaDep.Services
{
    public partial class LoadSearch : System.Web.UI.Page
    {
        protected DataTable dt = new DataTable();
        protected string sPaging = "";
        protected string search = "" , displaySearch = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            string page = Request["page"] == null ? "1" : Request["page"].ToString();
            search = Request["search"] == null ? "" : Request["search"].ToString();
            displaySearch = search;
            search = BAL.Utils.UnicodeToKoDau(search).ToLower().Replace(" ","");
            int pg = int.Parse(page) - 1;// pagingUtil.getCurrentPaging();
            int pSize = 4;
            int start = pg * pSize;
            string sql = @"select ImageId,name,img,title,Birthday,LikeFb,LikeWeb,CountComment,CountShare,ImgThumbList
                        from Images where img is not null and ImgThumb is not null and ImgThumbList is not null and  1=1 and(status=1 or status =2) and search like N'%" + search + "%' order by ImageId desc";
            dt = PaggingBO.LoadPage(sql, start, pSize);
            sPaging = PaggingBO.pagingSqlMutilParamForAjaxAndOrderableBO(sql, int.Parse(page), pSize, "loadItem", new string[] { });
        }
    }
}